﻿using System;
using System.Collections.Generic;

using Fuse8.DomainFramework.Common;

using Fuse8.ContentManagementFramework.Domain.Bases;
using Fuse8.ContentManagementFramework.SystemFacade;

namespace Fuse8.ContentManagementFramework.Domain.Special
{
    public class CmsEntitySentForApprovalEmail: BaseEmail<dynamic>
    {
        public CmsEntitySentForApprovalEmail(dynamic model)
        {
            Guard.ArgumentNotNull(model, "model");

            Model = model;
            
            To = new string[] { model.UserEmail };

            From = CmsConfiguration.SystemSenderEmail;

            Subject = "An entity required your approval";

            TemplateUrl = "/admin/assets/templates/EntitySentForApproval.html";
        }

        public override void Prepare()
        {
            ReplacementProperties = new Dictionary<string, string>();

            if (Model != null)
            {
                ReplacementProperties.Add("UserName", Model.UserName);
                ReplacementProperties.Add("Url", Model.Url);
            }
        }
    }
}
